package com.talent.jiwen_teacher.my;

import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.TextView;

import com.afollestad.materialdialogs.MaterialDialog;
import com.talent.jiwen_teacher.R;
import com.talent.jiwen_teacher.base.BaseActivity;
import com.talent.jiwen_teacher.util.CommonUtils;
import com.talent.jiwen_teacher.util.MaterialDialogUtil;

import butterknife.BindView;
import butterknife.OnClick;

import static com.talent.jiwen_teacher.my.WebShowActivity.IS_SERVICE_RIGHT;


/**
 * Created by qyqx on 2018/8/27.
 * 关于我们
 */

public class AboutUsActivity extends BaseActivity {

    @BindView(R.id.txt_version)
    TextView txt_version;


    @Override
    protected int provideContentViewId() {
        return R.layout.activity_about_us;
    }

    @Override
    public String titleName() {
        return "关于我们";
    }

    @Override
    protected void initData() {

        txt_version.setText("即问老师版 v"+ CommonUtils.getLocalVersionName(mContext));

    }

    @OnClick({R.id.rl_xie, R.id.rl_lian})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.rl_xie:
                IS_SERVICE_RIGHT=0;
                WebShowActivity.WEB_SHOW_TYPE=WebShowActivity.WEB_XIE_TYPE;
                intentActivity(WebShowActivity.class);
                break;
            case R.id.rl_lian:
                showCallDialog();
                break;

        }
    }

    public void showCallDialog(){

        MaterialDialog.Builder dialog= MaterialDialogUtil.getCommonDialog(AboutUsActivity.this, "联系我们", "电话：0769-21454399\n邮箱：service@uixkid.com", "拨打", "取消", new MaterialDialogUtil.OnDialogPoNeClickListener() {
            @Override
            public void onPositive() {
                callPhone("076921454399");
            }

            @Override
            public void onNegative() {

            }
        });

        dialog.show();
    }

    /**
     * 拨打电话（跳转到拨号界面，用户手动点击拨打）
     *
     * @param phoneNum 电话号码
     */
    public void callPhone(String phoneNum) {
        Intent intent = new Intent(Intent.ACTION_DIAL);
        Uri data = Uri.parse("tel:" + phoneNum);
        intent.setData(data);
        startActivity(intent);
    }
}
